
    // 这是初始化
  function setupWebViewJavascriptBridge(callback) {
        if (window.WebViewJavascriptBridge) { return callback(WebViewJavascriptBridge)};
        if (window.WVJBCallbacks) { return window.WVJBCallbacks.push(callback)};
        window.WVJBCallbacks = [callback];
        var WVJBIframe = document.createElement('iframe');
        WVJBIframe.style.display = 'none';
        WVJBIframe.src = 'https://__bridge_loaded__';
        document.documentElement.appendChild(WVJBIframe);
        setTimeout(function() { document.documentElement.removeChild(WVJBIframe) }, 0);
    }
   // 初始化结束
     
    setupWebViewJavascriptBridge(function(bridge) { 
      
        // js_ocToken用来OC给我传参数
    bridge.registerHandler('js_ocToken', function(data, responseCallback) {
                           
                var token = JSON.stringify(data);
                apiLoginByToken(token);

            
     });

        // 调用了OC的backToHome方法
    var js_oc = document.getElementById("js_oc");
        js_oc.onclick = function(e) {
            e.preventDefault();
            bridge.callHandler('backToHome',function(response) {
                log('JS got response', response);
            });
        }
    });
 


        
 

